package com.spring.springmvc.请求.json和java转换;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.spring.springmvc.请求.传参.People;

public class json转java {
    public static void main(String[] args) throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        String json = "{\"name\":\"zhangsan\",\"age\":15,\"sex\":\"男\"}";
        People people = objectMapper.readValue(json,People.class);
        System.out.println(people);
    }
}
/*
json是一个字符串
 */